package Decorateur;

import Composite.Element;
import espace_physique.*;
import fichiers.*;
import java.awt.*;
import java.io.*;
import javax.swing.*;
import javax.swing.tree.*;

public class MyDefaultTreeCellRendererLogique extends DefaultTreeCellRenderer{
    
    private TreeCellRenderer next;

    
    public MyDefaultTreeCellRendererLogique(TreeCellRenderer next) {
    
        this.next=next;
    }
    
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        
        DefaultMutableTreeNode t=(DefaultMutableTreeNode)value;
        Element f=(Element)t.getUserObject();
        JLabel valeurLabel=(JLabel) next.getTreeCellRendererComponent(tree,value,sel,expanded,leaf,row,hasFocus);
        valeurLabel.setIcon(f.getRepresentation());

         
        return valeurLabel;
    }
    
    
}
